package com.team407.cheyoubang.parse;

import org.json.JSONException;
import org.json.JSONObject;

import com.team407.cheyoubang.bean.MemberInfoBean;


public class LoginParseData extends BaseParseData {
	/**
	 * 获取 MemberInfoBean
	 */
	public static final String MEMBER_INFO = "memberInfo";
	@Override
	public Result getResult(JSONObject jsonObject) throws JSONException {
		JSONObject memberInfoObj = jsonObject.getJSONObject("memberInfo");
		MemberInfoBean memberInfoBean = getMemberInfo(memberInfoObj);
		mResult.put(MEMBER_INFO, memberInfoBean);
		return super.getResult(jsonObject);
	}
	
	public MemberInfoBean getMemberInfo(JSONObject jsonObject) throws JSONException{
		MemberInfoBean infoBean = new MemberInfoBean();
		infoBean.memberId = jsonObject.getInt("memberId");
		infoBean.memberNo = jsonObject.getString("memberNo");
		infoBean.realname = jsonObject.getString("realname");
		infoBean.status = jsonObject.getInt("status");
		infoBean.statusStr = jsonObject.getString("statusStr");
		infoBean.balance = (float)jsonObject.getDouble("balance");
		infoBean.bonusNotUsed = (float)jsonObject.getDouble("bonusNotUsed");
		infoBean.adBonus = (float)jsonObject.getDouble("adBonus");
		infoBean.registerPrice = (float)jsonObject.getDouble("registerPrice");
		infoBean.bonusIsSealRoof = jsonObject.getInt("bonusIsSealRoof");
		return infoBean;
	}

}
